package com.sun.hunk.struts.form;

import com.sun.hunk.hibernate.domain.Comment;
import com.sun.hunk.hibernate.domain.impl.DomainFactory;
import com.sun.hunk.struts.HunkActionForm;
import com.sun.hunk.util.CommonUtil;
import java.util.Date;

/**
 *
 * @author sunil
 */
public class CommentForm extends HunkActionForm {

    private Comment comment;

    public CommentForm() {
        comment = DomainFactory.getComment();
    }

    public String getDescription() {
        return comment.getDescription();
    }

    public void setDescription(String description) {
        comment.setDescription(description);
    }

    public Date getCreatedOn() {
        return comment.getCreatedOn();
    }

    public Comment getComment() {
        return comment;
    }

    public void setComment(Comment comment) {
        this.comment = comment;
    }

    public void setTopicId(Long id){
        if(CommonUtil.isNull(comment.getItem())){
            comment.setItem(DomainFactory.getItem(id));
        }else{
            comment.getItem().setId(id);
        }
    }

}
